-
Notifications
You must be signed in to change notification settings - Fork 1k
DocGenerator fixes #13968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DocGenerator fixes #13968
Conversation
| } | ||
|
|
||
| private static String getRepoPath() throws IOException { | ||
| URL resource = DocGeneratorApplication.class.getClassLoader().getResource(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about passing the root directory from gradle via system property like in
| systemProperty("scanPath", project.rootDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that is a lot cleaner, thank you for the suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The weird thing about getClassLoader().getResource("") is that afaik not all of the class loaders return anything for it. Here it would be ok, but in a real library it could cause surprises.
| try (BufferedWriter writer = | ||
| Files.newBufferedWriter( | ||
| Paths.get("docs/instrumentation-list.yaml"), Charset.defaultCharset())) { | ||
| Paths.get(baseRepoPath + "docs/instrumentation-list.yaml"), Charset.defaultCharset())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You really don't need to specify the charset. By default newBufferedWriter uses utf-8 which is what you want. Default charset could be something else.
Related to #13468
I had been running this successfully via an intellij configuration, but the gradle command was not working due to some relative path references. This PR updates the logic to use absolute paths, which fixes the ability to run this via
./gradlew :instrumentation-docs:runAnalysisfrom the repo root.It also fixes an issue where we were only parsing the contents of the first metrics file generated, but some instrumentations generate multiple files. The updated logic will combine all the entries from every file into a single list of metrics and then dedupe them by name.